import { createRouter, createWebHashHistory, RouteRecordRaw } from "vue-router";

// 定义路由规则
const routes: Array<RouteRecordRaw> = [
  {
    path : "/",
    name : "login-redirect",
    redirect : {name : "login"}
  },
  {
    path: "/main",
    name: "main",
    component: () => import("@/views/Main.vue"),
    redirect: { name: "home" },
    meta :{
      name : '首页',
    },
    children: [
      {
        path: "/home",
        name: "home",
        component: () => import("@/views/Home.vue")
      },
    ]
  },
  {
    path: "/login",
    name: "login",
    component: () => import("@/views/Login.vue"),
  },
  {
    path: '/404',
    name: '404',
    component: () => import('@/views/404.vue')
  },
];

// 创建路由器实例
const router = createRouter({
  history: createWebHashHistory(),
  routes, // 将 routes 配置传递给 router 实例
});

export default router;